package sg.edu.nus.iss.jass.dao;

import java.util.Map;

import sg.edu.nus.iss.jass.model.MockPropertiesDTO;

/**
 * @version 1.0
 * @author SE19 Team 1
 * 
 */
public class MockPropertiesDAO extends PropertiesDAO {
	
	public static String pathname = "properties/MockProperties.properties";
	
	public MockPropertiesDAO() {
		super(pathname, MockPropertiesDTO.class);
	}
	
	@SuppressWarnings("unchecked")
	public void setMockPropertiesDTO(MockPropertiesDTO mockPropertiesDTO) {
		Integer newTotal = getTotal() + 1;
		mockPropertiesDTO.setId(newTotal.toString());
		Map map = mockPropertiesDTO.getMap();
		map.put("totalRecords", newTotal.toString());
		this.setObject(pathname, map);
	}
	
	public MockPropertiesDTO getMockPropertiesDTO(String id) {
		MockPropertiesDTO mockPropertiesDTO = (MockPropertiesDTO)this.getObject(id);
		return mockPropertiesDTO.getId() == null ? null:mockPropertiesDTO;
	}
}
